Skip to content

Conversation

lesha-co
Copy link

@lesha-co lesha-co commented Oct 12, 2023

Fixes issue #1636

Some frameworks (e.g. django rest framework, I guess) generate following schema:

openapi: 3.0.3
info:
    version: 1.0.0
components:
    schemas:
        BlankEnum:
            enum:
                - ''

right now this library generates invalid typescript:

export enum BlankEnum {
     = '',
}

This happens in getEnum functions that don't check for invalid input (getEnum([''])) in our case.

I decided to give such enum values BLANK name so that generated files are correct

export enum BlankEnum {
    BLANK = '',
}

Not sure if it would be a better idea to just omit these values (I mean, the name says BlankEnum) but everything's better than broken syntax

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant